
export const getTableColumns = (params, machineTypeId) => {
  let columns = [{ headerName: machineTypeId, field: "MBB", minWidth: 60, flex: 1 }]
  params.forEach(item => {
    columns.push({ headerName: item.machineId.slice(4), field: item.machineId.slice(4), minWidth: 60, flex: 1 })
  })
  const temp = ['AST_1D', 'AST_10D', '基准值', '差异', '离散值']
  const fieldOptions = ['oneDayAst', 'tenDayAst', 'baseTT', 'diftenDayAst', 'tenDayeCv']
  let target = []
  params = [{}, ...params]
  fieldOptions.forEach((val, idx) => {
    let pool = {}
    params.forEach((item, index) => {
      let a = columns[index].field
      pool[a] = item[val] !== undefined ? item[val] : temp[idx]
    })
    target.push(pool)
  })

  return {
    columns,
    target
  }
}
